package com.ruoyi.web.controller.seventeentrack;

import com.jianqiao.delivery.seventeentrack.domain.RegisterEventEntity;
import com.jianqiao.delivery.seventeentrack.domain.RegisterParamVo;
import com.jianqiao.delivery.seventeentrack.service.SeventeenTrackService;
import com.ruoyi.common.core.domain.AjaxResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * author: cyx
 * create: 2024/11/18 11:29
 **/
@Slf4j
@RestController
@RequestMapping("/seventeenTrack")
public class SeventeenTrackController {

    @Autowired
    private SeventeenTrackService seventeenTrackService;

    @PostMapping("/register")
    public AjaxResult registerEvent(@RequestBody RegisterEventEntity registerEventEntity) {
        List<RegisterParamVo> registerParamList = registerEventEntity.getRegisterParamList();

        seventeenTrackService.registerEvent(registerParamList);
        return AjaxResult.success();
    }

    @PostMapping("/detail")
    public AjaxResult detailEvent(@RequestBody RegisterEventEntity registerEventEntity) {
        List<RegisterParamVo> registerParamList = registerEventEntity.getRegisterParamList();

        String result = seventeenTrackService.detailEvent(registerParamList);
        return AjaxResult.success(result);
    }

    @PostMapping("/notify")
    public void notify(@RequestBody String body) {
        log.info("get body ->" + body);
    }
}
